#include<bits/stdc++.h>
using namespace std;
int n;
int id;
int f[121];
vector<pair<pair<int,int>,int> > e;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	freopen("road.in","r",stdin);
	freopen("road.out","w",stdout);
	cin >> n;
	while((1 << id + 1) - 1 <= n) id++;
	e.push_back({{id,114},0});
	e.push_back({{id,114},1});
	for(int i = 1;i < id;i++)
	{
		e.push_back({{id - i,id - i + 1},0});
		e.push_back({{id - i,id - i + 1},1 << i});
	}
	if(n != (1 << id) - 1)
	{
		e.push_back({{1,114},n});
		int w = (n & 1);
		if(n & 1)
			e.push_back({{1,114},n ^ 1});
		for(int i = 1;(1 << (i + 1)) <= n;i++) if(n & (1 << i))
		{
			w += (1 << i);
			e.push_back({{1,id - i + 1},n - w});
		}
	}
	cout << id + 1 << " " << e.size() << "\n";
	for(auto i:e)
		cout << i.first.first << " " << i.first.second << " " << i.second << "\n";
	return 0;
}